Skip to content

Conversation

@MananTank
Copy link
Member

@MananTank MananTank commented Sep 29, 2025


PR-Codex overview

This PR focuses on enhancing the CreateNFTPage and LaunchNFT components to handle insufficient funds scenarios, including new callbacks and UI elements for notifying users about their balance and required funds. It also introduces gas estimation functions.

Detailed summary

  • Added onNotEnoughFunds callback to handle insufficient funds in CreateNFTPage.
  • Implemented total transaction cost calculation and wallet balance checks.
  • Introduced notEnoughFunds state in LaunchNFT for user notifications.
  • Enhanced UI to display fund requirements and options to buy more funds.
  • Added gas estimation functions, including getTransactionGasCost and getTotalTransactionCost.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • New Features
    • Gas-cost–aware NFT minting with per-batch gas & total cost estimation and wallet balance pre-checks.
    • Insufficient-funds flow that surfaces required vs available amounts and invokes a funding callback.
    • Integrated, theme- and chain-aware Buy Funds widget with Retry and Back actions.
    • Optional pay-modal–free transaction path for eligible batches.
    • Enhanced batch processing for ERC1155/721 that can abort and notify when funds are insufficient.

@vercel vercel bot temporarily deployed to Preview – wallet-ui September 29, 2025 18:36 Inactive
@vercel vercel bot temporarily deployed to Preview – nebula September 29, 2025 18:36 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 September 29, 2025 18:36 Inactive
@linear
Copy link

linear bot commented Sep 29, 2025

@vercel
Copy link

vercel bot commented Sep 29, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
thirdweb-www Ready Ready Preview Comment Sep 30, 2025 3:00pm
4 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
docs-v2 Skipped Skipped Sep 30, 2025 3:00pm
nebula Skipped Skipped Sep 30, 2025 3:00pm
thirdweb_playground Skipped Skipped Sep 30, 2025 3:00pm
wallet-ui Skipped Skipped Sep 30, 2025 3:00pm

@vercel vercel bot temporarily deployed to Preview – thirdweb_playground September 29, 2025 18:36 Inactive
@changeset-bot
Copy link

changeset-bot bot commented Sep 29, 2025

⚠️ No Changeset found

Latest commit: b2239c9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@MananTank MananTank marked this pull request as ready for review September 29, 2025 18:36
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 29, 2025

Walkthrough

Adds an onNotEnoughFunds callback to ERC1155 claim-conditions flows, implements gas-cost aware batching with pre-batch balance checks and an alternate no-pay-modal send path, and adds UI and state to handle insufficient funds (BuyWidget, retry/back). Also updates related exported function signatures.

Changes

Cohort / File(s) Summary
ERC1155 claim conditions param update
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/_common/form.ts
Adds onNotEnoughFunds: (data: { requiredAmount: string; balance: string; }) => void to the erc1155.setClaimConditions params in CreateNFTCollectionFunctions.
Gas‑cost aware batching and send flow
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/create-nft-page.tsx
Adds gas estimation and total-cost helpers; computes total cost for batched ERC1155 mints and checks wallet balance before first batch when not gasless; invokes onNotEnoughFunds and aborts main path if insufficient; introduces a no-pay-modal send path; updates handleSetClaimConditionsERC1155 signature to accept onNotEnoughFunds.
Launch UI: insufficient funds handling
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx
Adds notEnoughFunds state and UI flow, injects onNotEnoughFunds into ERC1155/ERC721 paths, conditionally shows a themed BuyWidget with buy/retry/back actions, and preserves existing deployment step logic.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant UI as Launch UI
  participant Page as Create NFT Page
  participant Chain as Chain/Wallet

  Note over UI,Page: Set Claim Conditions (ERC1155)

  User->>UI: Start launch
  UI->>Page: setClaimConditions({ values, batch, gasless, onNotEnoughFunds })

  alt Not gasless and first batch
    Page->>Chain: estimate gas + value
    Page->>Chain: get wallet balance
    alt Balance >= totalCost
      Page->>Chain: send and confirm (standard or no-pay-modal)
      Chain-->>Page: tx receipt
      Page-->>UI: success
    else Insufficient funds
      Page-->>UI: onNotEnoughFunds({ requiredAmount, balance })
      UI->>UI: Show Insufficient Funds panel (BuyWidget / Retry)
    end
  else Gasless or subsequent batches
    Page->>Chain: send and confirm
    Chain-->>Page: tx receipt
    Page-->>UI: success
  end
Loading
sequenceDiagram
  autonumber
  actor User
  participant UI as Launch UI
  participant Buy as BuyWidget
  participant Chain as Chain/Wallet

  Note over UI: Insufficient funds flow

  UI->>User: Display required vs balance, actions
  User-->>UI: Click "Buy Funds"
  UI->>Buy: Open with amount (required - balance)
  Buy->>Chain: Purchase flow
  Chain-->>Buy: Funds received
  Buy-->>UI: onSuccess
  UI->>User: Enable Retry
  User-->>UI: Click "Retry"
  UI->>Page: Re-run setClaimConditions (with same onNotEnoughFunds)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Pre-merge checks and finishing touches

❌ Failed checks (4 warnings)
Check name Status Explanation Resolution
Linked Issues Check ⚠️ Warning The changes introduced focus on insufficient-funds handling and gas estimation for NFT creation, whereas the linked issue MNY-214 targets a bug in the token selection panel that spins indefinitely when no chain is selected, and no code modifications related to token selection or chain state are present. Implement or reference code changes to handle the token selection panel’s loading state when no chain is selected, ensuring that the panel stops spinning and provides feedback, or update the linked issue if it no longer applies to this PR’s scope.
Out of Scope Changes Check ⚠️ Warning This pull request adds extensive gas-cost estimation logic, insufficient-funds callbacks, and a BuyWidget for NFT minting, none of which relate to the linked issue’s scope of fixing the token selection panel behavior when no chain is selected. Split the NFT creation UX enhancements into a separate feature branch or remove these unrelated changes so that this PR only contains the code needed to resolve the token selection panel spinning issue.
Description Check ⚠️ Warning The pull request description retains the template in comments and provides a PR-Codex overview but does not include any filled-in sections for title, reviewer notes, or testing instructions, leaving the required template sections incomplete. Please fill out the repository’s PR description template by adding a concise title line, notes for the reviewer, and detailed testing steps under the respective “Notes for the reviewer” and “How to test” headings.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title accurately and concisely describes the primary change of improving the ERC1155 claim conditions step UX within the Dashboard, matching the changeset’s focus on insufficient funds handling in NFT creation.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 09-30-_mny-214_dashboard_erc1155_set_claim_conditions_ux_improvements

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • TEAM-0000: Entity not found: Issue - Could not find referenced Issue.

Comment @coderabbitai help to get the list of available commands and usage tips.

@MananTank MananTank requested review from a team as code owners September 29, 2025 18:36
@github-actions github-actions bot added the Dashboard Involves changes to the Dashboard. label Sep 29, 2025
Copy link
Member Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@MananTank MananTank force-pushed the 09-30-_mny-214_dashboard_erc1155_set_claim_conditions_ux_improvements branch from db0b012 to 5830b1a Compare September 29, 2025 18:38
@vercel vercel bot temporarily deployed to Preview – nebula September 29, 2025 18:38 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground September 29, 2025 18:38 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 September 29, 2025 18:38 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui September 29, 2025 18:38 Inactive
@MananTank MananTank changed the title [MNY-214] Dashboard: ERC1155 set claim conditions UX improvements [MNY-214] Dashboard: ERC1155 set claim conditions step UX improvements Sep 29, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (9)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/_common/form.ts (1)

77-81: Clarify units and carry precise values (avoid float rounding).

requiredAmount/balance are strings, but downstream code subtracts them via Number(), which can round/overflow. Surface precise values as wei alongside the human strings.

Apply this typing tweak (backward‑compatible) so callers can use bigint math:

-      onNotEnoughFunds: (data: {
-        requiredAmount: string;
-        balance: string;
-      }) => void;
+      onNotEnoughFunds: (data: {
+        // precise amounts for math
+        requiredWei: bigint;
+        balanceWei: bigint;
+        // optional humanized strings for UI
+        requiredAmount?: string;
+        balance?: string;
+      }) => void;

Then emit both wei and human strings where available. This prevents under/over‑buy issues later.

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx (4)

80-83: Use resolvedTheme to avoid “system” mis‑mapping.

theme can be "system". Use resolvedTheme to pass an accurate light/dark to getSDKTheme.

-import { useTheme } from "next-themes";
+import { useTheme } from "next-themes";
...
-  const { theme } = useTheme();
+  const { resolvedTheme } = useTheme();

And later:

- theme={getSDKTheme(theme === "dark" ? "dark" : "light")}
+ theme={getSDKTheme(resolvedTheme === "dark" ? "dark" : "light")}

81-83: Avoid duplicate chain lookups; reuse the same hook result.

You call useV5DashboardChain twice for the same chainId (chainMeta and chain). Keep one value (e.g., chain) and reuse for symbol and props.

-  const chainMeta = useV5DashboardChain(Number(formValues.collectionInfo.chain));
+  const chain = useV5DashboardChain(Number(formValues.collectionInfo.chain));
...
-  buttonLabel={`Buy ${chainMeta?.nativeCurrency?.symbol || "ETH"}`}
+  buttonLabel={`Buy ${chain?.nativeCurrency?.symbol || "ETH"}`}
...
-  const chain = useV5DashboardChain(Number(formValues.collectionInfo.chain));
+  // reuse the existing `chain`

Also applies to: 353-354


446-535: Error panel coupling to stale notEnoughFunds state.

renderError shows the “Not enough funds” block whenever notEnoughFunds is truthy, even if the current error is unrelated (e.g., RPC error after a successful top‑up). You reset state on Retry, but a second failure before reset can mislead.

Gate the block on both notEnoughFunds and an errorMessage that includes “insufficient funds” or a dedicated error code, or clear notEnoughFunds on modal open and set it only from the current failed step.


398-439: Consider code‑splitting BuyWidget to keep the dialog light.

BuyWidget is heavy. Load it only when needed.

- import { BuyWidget, ... } from "thirdweb/react";
+ import dynamic from "next/dynamic";
+ const BuyWidget = dynamic(() => import("thirdweb/react").then(m => m.BuyWidget), { ssr: false });

This defers its cost until the buy flow is shown.

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/create-nft-page.tsx (4)

301-335: Funds check only on first batch; confirm intended UX.

You pre‑check balance for totalBatches and then send only the first batch without the pay modal; subsequent batches use the default sender. That’s fine if the precheck succeeds, but confirm you don’t want to disable the pay modal for later batches too (it won’t show with sufficient funds, but the hook still runs).

Optionally pass the same no‑pay‑modal sender for all batches after a successful precheck to keep behavior uniform.


315-329: Emit precise values to onNotEnoughFunds for downstream math.

You currently pass strings via toEther and then throw. Surface the wei values too so consumers can compute exact deltas without string→Number casts.

- params.onNotEnoughFunds({
-   balance: toEther(walletBalance.value),
-   requiredAmount: toEther(totalCost),
- });
+ params.onNotEnoughFunds({
+   requiredWei: totalCost,
+   balanceWei: walletBalance.value,
+   requiredAmount: toEther(totalCost),
+   balance: toEther(walletBalance.value),
+ });

466-472: Naive gas fallback can be too low; tie to data length.

Fallback uses 1,000,000 gas regardless of batch size. For large multicalls, this can still under‑estimate and trip the buy flow again.

Scale fallback by call count (or calldata length) and increase buffer:

-    return 1_000_000n * gasPrice;
+    // heuristic: 100k per call + 200k base, then 20% buffer
+    const calls = Array.isArray((tx as any).data) ? (tx as any).data.length : 1;
+    const base = BigInt(200_000 + 100_000 * calls);
+    return (base * gasPrice * 12n) / 10n;

Also consider exposing a knob to tune the buffer.


448-484: Minor: tighten comment and ensure value retrieval order is safe.

The note says “get tx.value AFTER estimateGasCost”, but value is retrieved in getTotalTransactionCost. If this ordering matters for your PreparedTransaction, add a short explanation or move value resolution next to estimateGasCost to make the dependency obvious.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 496615f and 5830b1a.

📒 Files selected for processing (3)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/_common/form.ts (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/create-nft-page.tsx (6 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx (7 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose

**/*.{ts,tsx}: Use explicit function declarations and explicit return types in TypeScript
Limit each file to one stateless, single‑responsibility function
Re‑use shared types from @/types where applicable
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Prefer composition over inheritance; use utility types (Partial, Pick, etc.)
Lazy‑import optional features and avoid top‑level side‑effects to reduce bundle size

Files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/_common/form.ts
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/create-nft-page.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

Files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/_common/form.ts
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/create-nft-page.tsx
apps/{dashboard,playground-web}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

apps/{dashboard,playground-web}/**/*.{ts,tsx}: Import UI primitives from @/components/ui/* (Button, Input, Select, Tabs, Card, Sidebar, Badge, Separator) in dashboard and playground apps
Use NavLink for internal navigation with automatic active states in dashboard and playground apps
Use Tailwind CSS only – no inline styles or CSS modules
Use cn() from @/lib/utils for conditional class logic
Use design system tokens (e.g., bg-card, border-border, text-muted-foreground)
Server Components (Node edge): Start files with import "server-only";
Client Components (browser): Begin files with 'use client';
Always call getAuthToken() to retrieve JWT from cookies on server side
Use Authorization: Bearer header – never embed tokens in URLs
Return typed results (e.g., Project[], User[]) – avoid any
Wrap client-side data fetching calls in React Query (@tanstack/react-query)
Use descriptive, stable queryKeys for React Query cache hits
Configure staleTime/cacheTime in React Query based on freshness (default ≥ 60s)
Keep tokens secret via internal API routes or server actions
Never import posthog-js in server components

Files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/_common/form.ts
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/create-nft-page.tsx
apps/{dashboard,playground}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

apps/{dashboard,playground}/**/*.{ts,tsx}: Import UI primitives from @/components/ui/_ (e.g., Button, Input, Tabs, Card)
Use NavLink for internal navigation to get active state handling
Use Tailwind CSS for styling; no inline styles
Merge class names with cn() from @/lib/utils for conditional classes
Stick to design tokens (e.g., bg-card, border-border, text-muted-foreground)
Server Components must start with import "server-only"; use next/headers, server‑only env, heavy data fetching, and redirect() where appropriate
Client Components must start with 'use client'; handle interactivity with hooks and browser APIs
Server-side data fetching: call getAuthToken() from cookies, send Authorization: Bearer <token> header, and return typed results (avoid any)
Client-side data fetching: wrap calls in React Query with descriptive, stable queryKeys and set sensible staleTime/cacheTime (≥ 60s default); keep tokens secret via internal routes or server actions
Do not import posthog-js in server components (client-side only)

Files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/_common/form.ts
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/create-nft-page.tsx
apps/{dashboard,playground}/**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

Expose a className prop on the root element of every component

Files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/create-nft-page.tsx
🧠 Learnings (16)
📚 Learning: 2025-06-10T00:46:00.514Z
Learnt from: MananTank
PR: thirdweb-dev/js#7315
File: apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/assets/create/nft/form.ts:25-42
Timestamp: 2025-06-10T00:46:00.514Z
Learning: In NFT creation functions, the setClaimConditions function signatures are intentionally different between ERC721 and ERC1155. ERC721 setClaimConditions accepts the full CreateNFTFormValues, while ERC1155 setClaimConditions accepts a custom object with nftCollectionInfo and nftBatch parameters because it processes batches differently than the entire form data.

Applied to files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/_common/form.ts
📚 Learning: 2025-06-10T00:50:20.795Z
Learnt from: MananTank
PR: thirdweb-dev/js#7315
File: apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/assets/create/nft/launch-nft.tsx:153-226
Timestamp: 2025-06-10T00:50:20.795Z
Learning: In apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/assets/create/nft/launch-nft.tsx, the updateStatus function correctly expects a complete MultiStepState["status"] object. For pending states, { type: "pending" } is the entire status object. For error states, { type: "error", message: React.ReactNode } is the entire status object. The current code incorrectly spreads the entire step object instead of passing just the status object.

Applied to files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Interactive UI that relies on hooks (`useState`, `useEffect`, React Query, wallet hooks).

Applied to files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx
📚 Learning: 2025-07-31T16:17:42.753Z
Learnt from: MananTank
PR: thirdweb-dev/js#7768
File: apps/playground-web/src/app/navLinks.ts:1-1
Timestamp: 2025-07-31T16:17:42.753Z
Learning: Configuration files that import and reference React components (like icon components from lucide-react) need the "use client" directive, even if they primarily export static data, because the referenced components need to be executed in a client context when used by other client components.

Applied to files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Anything that consumes hooks from `tanstack/react-query` or thirdweb SDKs.

Applied to files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/create-nft-page.tsx
📚 Learning: 2025-07-07T21:21:47.488Z
Learnt from: saminacodes
PR: thirdweb-dev/js#7543
File: apps/portal/src/app/pay/page.mdx:4-4
Timestamp: 2025-07-07T21:21:47.488Z
Learning: In the thirdweb-dev/js repository, lucide-react icons must be imported with the "Icon" suffix (e.g., ExternalLinkIcon, RocketIcon) as required by the new linting rule, contrary to the typical lucide-react convention of importing without the suffix.

Applied to files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx
📚 Learning: 2025-05-30T17:14:25.332Z
Learnt from: MananTank
PR: thirdweb-dev/js#7227
File: apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/modules/components/OpenEditionMetadata.tsx:26-26
Timestamp: 2025-05-30T17:14:25.332Z
Learning: The ModuleCardUIProps interface already includes a client prop of type ThirdwebClient, so when components use `Omit<ModuleCardUIProps, "children" | "updateButton">`, they inherit the client prop without needing to add it explicitly.

Applied to files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : When you need access to browser APIs (localStorage, window, IntersectionObserver etc.).

Applied to files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*.{tsx,jsx} : For notices & skeletons rely on `AnnouncementBanner`, `GenericLoadingPage`, `EmptyStateCard`.

Applied to files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to apps/{dashboard,playground-web}/**/*.{ts,tsx} : Import UI primitives from `@/components/ui/*` (Button, Input, Select, Tabs, Card, Sidebar, Badge, Separator) in dashboard and playground apps

Applied to files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*.{tsx,jsx} : Reuse core UI primitives; avoid re-implementing buttons, cards, modals.

Applied to files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to apps/{dashboard,playground}/**/*.{ts,tsx} : Import UI primitives from `@/components/ui/_` (e.g., Button, Input, Tabs, Card)

Applied to files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx
📚 Learning: 2025-09-17T11:02:13.528Z
Learnt from: MananTank
PR: thirdweb-dev/js#8044
File: packages/thirdweb/src/react/web/ui/Bridge/swap-widget/use-tokens.ts:15-17
Timestamp: 2025-09-17T11:02:13.528Z
Learning: The thirdweb `client` object is serializable and can safely be used in React Query keys, similar to the `contract` object.

Applied to files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/create-nft-page.tsx
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/wallets/** : EIP-1193, EIP-5792, EIP-7702 standard support in wallet modules

Applied to files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/create-nft-page.tsx
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/wallets/** : Smart wallets with account abstraction

Applied to files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/create-nft-page.tsx
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/wallets/** : Unified `Wallet` and `Account` interfaces in wallet architecture

Applied to files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/create-nft-page.tsx
🧬 Code graph analysis (2)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx (4)
apps/dashboard/src/@/hooks/chains/v5-adapter.ts (1)
  • useV5DashboardChain (14-28)
apps/dashboard/src/@/utils/sdk-component-theme.ts (1)
  • getSDKTheme (8-43)
apps/dashboard/src/@/components/blocks/multi-step-status/multi-step-status.tsx (1)
  • MultiStepStatus (27-97)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/_common/storage-error-upsell.tsx (1)
  • StorageErrorPlanUpsell (16-123)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/create-nft-page.tsx (3)
apps/dashboard/src/@/hooks/useSendTx.ts (1)
  • useSendAndConfirmTx (9-19)
packages/thirdweb/src/exports/thirdweb.ts (3)
  • PreparedTransaction (179-179)
  • estimateGasCost (154-154)
  • getGasPrice (118-118)
packages/thirdweb/src/exports/utils.ts (1)
  • resolvePromisedValue (198-198)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Size
  • GitHub Check: Unit Tests
  • GitHub Check: Build Packages
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)

@codecov
Copy link

codecov bot commented Sep 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.28%. Comparing base (ca701a4) to head (b2239c9).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8146   +/-   ##
=======================================
  Coverage   56.28%   56.28%           
=======================================
  Files         906      906           
  Lines       59208    59208           
  Branches     4180     4180           
=======================================
  Hits        33324    33324           
  Misses      25779    25779           
  Partials      105      105           
Flag Coverage Δ
packages 56.28% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@graphite-app
Copy link
Contributor

graphite-app bot commented Sep 30, 2025

Merge activity

#8146)

<!--

## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes"

If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000):

## Notes for the reviewer

Anything important to call out? Be sure to also clarify these in your comments.

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces functionality for handling insufficient funds when creating NFTs, enhancing the user experience by allowing users to buy funds directly if their balance is low.

### Detailed summary
- Added `onNotEnoughFunds` callback to handle insufficient funds.
- Implemented logic to calculate total transaction costs.
- Integrated `BuyWidget` to enable users to purchase funds directly.
- Enhanced error handling and user feedback for fund-related issues.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- New Features
  - Gas-cost–aware NFT minting with total cost estimation and balance pre-checks.
  - Insufficient funds handling with a user-facing prompt showing required vs. available balance.
  - Integrated Buy Funds widget with theme and chain awareness, plus retry and back controls.
  - Optional transaction path that skips the pay modal in eligible scenarios.
  - Enhanced batch processing for ERC1155/721 flows with a callback to surface funding issues.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@graphite-app graphite-app bot force-pushed the 09-30-_mny-214_dashboard_erc1155_set_claim_conditions_ux_improvements branch from 5830b1a to b2239c9 Compare September 30, 2025 14:51
@vercel vercel bot temporarily deployed to Preview – wallet-ui September 30, 2025 14:51 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground September 30, 2025 14:51 Inactive
@vercel vercel bot temporarily deployed to Preview – nebula September 30, 2025 14:51 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 September 30, 2025 14:51 Inactive
@github-actions
Copy link
Contributor

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 64.69 KB (0%) 1.3 s (0%) 211 ms (+172.16% 🔺) 1.6 s
thirdweb (cjs) 361.52 KB (0%) 7.3 s (0%) 845 ms (+10.86% 🔺) 8.1 s
thirdweb (minimal + tree-shaking) 5.73 KB (0%) 115 ms (0%) 125 ms (+2429.33% 🔺) 239 ms
thirdweb/chains (tree-shaking) 526 B (0%) 11 ms (0%) 54 ms (+2307.21% 🔺) 64 ms
thirdweb/react (minimal + tree-shaking) 19.14 KB (0%) 383 ms (0%) 106 ms (+2541.4% 🔺) 489 ms

@graphite-app graphite-app bot merged commit b2239c9 into main Sep 30, 2025
24 of 25 checks passed
@graphite-app graphite-app bot deleted the 09-30-_mny-214_dashboard_erc1155_set_claim_conditions_ux_improvements branch September 30, 2025 15:00
@vercel vercel bot temporarily deployed to Production – docs-v2 September 30, 2025 15:00 Inactive
@vercel vercel bot temporarily deployed to Production – nebula September 30, 2025 15:00 Inactive
@vercel vercel bot temporarily deployed to Production – wallet-ui September 30, 2025 15:00 Inactive
@vercel vercel bot temporarily deployed to Production – thirdweb_playground September 30, 2025 15:00 Inactive
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx (1)

424-429: Precision bug in BuyWidget amount: avoid Number() for token math

Number() on decimal strings can under/over-estimate 18‑decimals; compute in wei and clamp to 0 before converting to display units. This also resolves potential negative values when balance ≈ required.

Apply this diff:

-                amount={String(
-                  Number(notEnoughFunds.values.requiredAmount) -
-                    Number(notEnoughFunds.values.balance),
-                )}
+                amount={(() => {
+                  const required = toWei(notEnoughFunds.values.requiredAmount);
+                  const balance = toWei(notEnoughFunds.values.balance);
+                  const delta = required > balance ? required - balance : 0n;
+                  return toEther(delta);
+                })()}

And update imports:

-import type { ThirdwebClient } from "thirdweb";
+import { toEther, toWei, type ThirdwebClient } from "thirdweb";
🧹 Nitpick comments (5)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx (2)

469-470: Scope “not enough funds” UI to the relevant step only

Render the funding panel only for Set Claim Conditions errors to avoid shadowing unrelated step errors.

-                  if (notEnoughFunds) {
+                  if (notEnoughFunds && step.id === stepIds["set-claim-conditions"]) {

81-84: De-duplicate chain hook usage (one call, reuse everywhere)

useV5DashboardChain is called twice; compute once and reuse to reduce work and avoid identity drift.

-  const chainMeta = useV5DashboardChain(
+  const chain = useV5DashboardChain(
     Number(formValues.collectionInfo.chain),
   );
-  const chain = useV5DashboardChain(Number(formValues.collectionInfo.chain));
+  // reuse the `chain` computed above
-                buttonLabel={`Buy ${chainMeta?.nativeCurrency?.symbol || "ETH"}`}
+                buttonLabel={`Buy ${chain?.nativeCurrency?.symbol || "ETH"}`}
-                              {chainMeta?.nativeCurrency?.symbol || "ETH"}
+                              {chain?.nativeCurrency?.symbol || "ETH"}
-                              {chainMeta?.nativeCurrency?.symbol || "ETH"}
+                              {chain?.nativeCurrency?.symbol || "ETH"}

Also applies to: 353-355, 428-429, 484-489

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/create-nft-page.tsx (3)

301-334: Keep pay‑modal behavior consistent across all batches

After prechecking funds on batch 1, send the remaining batches via the no‑pay‑modal path too to avoid a pay modal popping up mid‑flow.

-    const totalBatches = Math.ceil(values.nfts.length / batch.count);
-
-    if (batch.startIndex === 0 && totalBatches > 1 && !params.gasless) {
+    const totalBatches = Math.ceil(values.nfts.length / batch.count);
+    const shouldUseNoPayModal = totalBatches > 1 && !params.gasless;
+
+    if (batch.startIndex === 0 && shouldUseNoPayModal) {
       if (!activeAccount) {
         throw new Error("Wallet is not connected");
       }
 
-      const costPerBatch = await getTotalTransactionCost({
+      const costPerBatch = await getTotalTransactionCost({
         tx: tx,
         from: activeAccount.address,
+        // scale fallback by tx count to be safer if estimation fails
+        fallbackGasUnits: 300_000n * BigInt(encodedTransactions.length),
       });
 
       const totalCost = costPerBatch * BigInt(totalBatches);
 ...
-      await sendAndConfirmTxNoPayModal.mutateAsync(tx);
-    } else {
-      await sendAndConfirmTx.mutateAsync(tx);
-    }
+      await sendAndConfirmTxNoPayModal.mutateAsync(tx);
+    } else if (shouldUseNoPayModal) {
+      await sendAndConfirmTxNoPayModal.mutateAsync(tx);
+    } else {
+      await sendAndConfirmTx.mutateAsync(tx);
+    }

448-485: Make gas fallback tunable; scale with batch size when estimation fails

A fixed 1,000,000 gas fallback can under/over‑estimate multicalls of varying sizes. Accept an optional fallbackGasUnits and let callers scale it (e.g., 300k × calls).

-async function getTransactionGasCost(tx: PreparedTransaction, from?: string) {
+async function getTransactionGasCost(
+  tx: PreparedTransaction,
+  from?: string,
+  fallbackGasUnits?: bigint,
+) {
   try {
     const gasCost = await estimateGasCost({
       from,
       transaction: tx,
     });
 
     const bufferCost = gasCost.wei / 10n;
 
     // Note: get tx.value AFTER estimateGasCost
     // add 10% extra gas cost to the estimate to ensure user buys enough to cover the tx cost
     return gasCost.wei + bufferCost;
   } catch {
     if (from) {
       // try again without passing from
-      return await getTransactionGasCost(tx);
+      return await getTransactionGasCost(tx, undefined, fallbackGasUnits);
     }
     // fallback if both fail, use the tx value + 1M * gas price
     const gasPrice = await getGasPrice({
       chain: tx.chain,
       client: tx.client,
     });
 
-    return 1_000_000n * gasPrice;
+    return (fallbackGasUnits ?? 1_000_000n) * gasPrice;
   }
 }
 
-async function getTotalTransactionCost(params: {
-  tx: PreparedTransaction;
-  from?: string;
-}) {
+async function getTotalTransactionCost(params: {
+  tx: PreparedTransaction;
+  from?: string;
+  fallbackGasUnits?: bigint;
+}) {
   const [txValue, txGasCost] = await Promise.all([
     resolvePromisedValue(params.tx.value),
-    getTransactionGasCost(params.tx, params.from),
+    getTransactionGasCost(params.tx, params.from, params.fallbackGasUnits),
   ]);
   return (txValue || 0n) + txGasCost;
 }

234-238: Optional: include wei fields in onNotEnoughFunds to eliminate downstream parsing

Passing BigInt wei alongside human strings avoids repeated string→wei conversions in the UI and prevents precision bugs.

-    onNotEnoughFunds: (data: {
-      requiredAmount: string;
-      balance: string;
-    }) => void;
+    onNotEnoughFunds: (data: {
+      requiredAmount: string;
+      balance: string;
+      requiredWei: bigint;
+      balanceWei: bigint;
+    }) => void;
-        params.onNotEnoughFunds({
-          balance: toEther(walletBalance.value),
-          requiredAmount: toEther(totalCost),
-        });
+        params.onNotEnoughFunds({
+          balance: toEther(walletBalance.value),
+          requiredAmount: toEther(totalCost),
+          balanceWei: walletBalance.value,
+          requiredWei: totalCost,
+        });

If you adopt this, the Launch UI amount becomes a simple toEther(requiredWei - balanceWei) without toWei. Based on learnings.

Also applies to: 321-325

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5830b1a and b2239c9.

📒 Files selected for processing (3)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/_common/form.ts (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/create-nft-page.tsx (6 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx (7 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/_common/form.ts
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose

**/*.{ts,tsx}: Use explicit function declarations and explicit return types in TypeScript
Limit each file to one stateless, single‑responsibility function
Re‑use shared types from @/types where applicable
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Prefer composition over inheritance; use utility types (Partial, Pick, etc.)
Lazy‑import optional features and avoid top‑level side‑effects to reduce bundle size

Files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/create-nft-page.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

Files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/create-nft-page.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx
apps/{dashboard,playground-web}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

apps/{dashboard,playground-web}/**/*.{ts,tsx}: Import UI primitives from @/components/ui/* (Button, Input, Select, Tabs, Card, Sidebar, Badge, Separator) in dashboard and playground apps
Use NavLink for internal navigation with automatic active states in dashboard and playground apps
Use Tailwind CSS only – no inline styles or CSS modules
Use cn() from @/lib/utils for conditional class logic
Use design system tokens (e.g., bg-card, border-border, text-muted-foreground)
Server Components (Node edge): Start files with import "server-only";
Client Components (browser): Begin files with 'use client';
Always call getAuthToken() to retrieve JWT from cookies on server side
Use Authorization: Bearer header – never embed tokens in URLs
Return typed results (e.g., Project[], User[]) – avoid any
Wrap client-side data fetching calls in React Query (@tanstack/react-query)
Use descriptive, stable queryKeys for React Query cache hits
Configure staleTime/cacheTime in React Query based on freshness (default ≥ 60s)
Keep tokens secret via internal API routes or server actions
Never import posthog-js in server components

Files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/create-nft-page.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx
apps/{dashboard,playground}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

apps/{dashboard,playground}/**/*.{ts,tsx}: Import UI primitives from @/components/ui/_ (e.g., Button, Input, Tabs, Card)
Use NavLink for internal navigation to get active state handling
Use Tailwind CSS for styling; no inline styles
Merge class names with cn() from @/lib/utils for conditional classes
Stick to design tokens (e.g., bg-card, border-border, text-muted-foreground)
Server Components must start with import "server-only"; use next/headers, server‑only env, heavy data fetching, and redirect() where appropriate
Client Components must start with 'use client'; handle interactivity with hooks and browser APIs
Server-side data fetching: call getAuthToken() from cookies, send Authorization: Bearer <token> header, and return typed results (avoid any)
Client-side data fetching: wrap calls in React Query with descriptive, stable queryKeys and set sensible staleTime/cacheTime (≥ 60s default); keep tokens secret via internal routes or server actions
Do not import posthog-js in server components (client-side only)

Files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/create-nft-page.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx
apps/{dashboard,playground}/**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

Expose a className prop on the root element of every component

Files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/create-nft-page.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx
🧠 Learnings (6)
📚 Learning: 2025-09-17T11:02:13.528Z
Learnt from: MananTank
PR: thirdweb-dev/js#8044
File: packages/thirdweb/src/react/web/ui/Bridge/swap-widget/use-tokens.ts:15-17
Timestamp: 2025-09-17T11:02:13.528Z
Learning: The thirdweb `client` object is serializable and can safely be used in React Query keys, similar to the `contract` object.

Applied to files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/create-nft-page.tsx
📚 Learning: 2025-06-10T00:50:20.795Z
Learnt from: MananTank
PR: thirdweb-dev/js#7315
File: apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/assets/create/nft/launch-nft.tsx:153-226
Timestamp: 2025-06-10T00:50:20.795Z
Learning: In apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/assets/create/nft/launch-nft.tsx, the updateStatus function correctly expects a complete MultiStepState["status"] object. For pending states, { type: "pending" } is the entire status object. For error states, { type: "error", message: React.ReactNode } is the entire status object. The current code incorrectly spreads the entire step object instead of passing just the status object.

Applied to files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx
📚 Learning: 2025-06-26T19:46:04.024Z
Learnt from: gregfromstl
PR: thirdweb-dev/js#7450
File: packages/thirdweb/src/bridge/Webhook.ts:57-81
Timestamp: 2025-06-26T19:46:04.024Z
Learning: In the onramp webhook schema (`packages/thirdweb/src/bridge/Webhook.ts`), the `currencyAmount` field is intentionally typed as `z.number()` while other amount fields use `z.string()` because `currencyAmount` represents fiat currency amounts in decimals (like $10.50), whereas other amount fields represent token amounts in wei (very large integers that benefit from bigint representation). The different naming convention (`currencyAmount` vs `amount`) reflects this intentional distinction.

Applied to files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Interactive UI that relies on hooks (`useState`, `useEffect`, React Query, wallet hooks).

Applied to files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx
📚 Learning: 2025-07-31T16:17:42.753Z
Learnt from: MananTank
PR: thirdweb-dev/js#7768
File: apps/playground-web/src/app/navLinks.ts:1-1
Timestamp: 2025-07-31T16:17:42.753Z
Learning: Configuration files that import and reference React components (like icon components from lucide-react) need the "use client" directive, even if they primarily export static data, because the referenced components need to be executed in a client context when used by other client components.

Applied to files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*.{tsx,jsx} : For notices & skeletons rely on `AnnouncementBanner`, `GenericLoadingPage`, `EmptyStateCard`.

Applied to files:

  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx
🧬 Code graph analysis (2)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/create-nft-page.tsx (3)
apps/dashboard/src/@/hooks/useSendTx.ts (1)
  • useSendAndConfirmTx (9-19)
packages/thirdweb/src/exports/thirdweb.ts (3)
  • PreparedTransaction (179-179)
  • estimateGasCost (154-154)
  • getGasPrice (118-118)
packages/thirdweb/src/exports/utils.ts (1)
  • resolvePromisedValue (198-198)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx (4)
apps/dashboard/src/@/hooks/chains/v5-adapter.ts (1)
  • useV5DashboardChain (14-28)
apps/dashboard/src/@/utils/sdk-component-theme.ts (1)
  • getSDKTheme (8-43)
apps/dashboard/src/@/components/blocks/multi-step-status/multi-step-status.tsx (1)
  • MultiStepStatus (27-97)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/_common/storage-error-upsell.tsx (1)
  • StorageErrorPlanUpsell (16-123)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Size
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (2)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/launch/launch-nft.tsx (1)

402-440: Funds UX flow looks solid

Nice integration of BuyWidget with back/ retry paths and descriptive error content; status model updates are correctly scoped and consistent with MultiStepStatus expectations.

Also applies to: 446-457, 493-526, 538-557

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/nft/create-nft-page.tsx (1)

297-334: Pre‑batch funds check and error surfacing: solid approach

The total‑cost precheck, descriptive error, and callback for UI handling are well‑structured and keep batching resilient.

Please verify the multicall estimate path on low‑liquidity RPCs (where estimateGas can fail) once with the new fallbackGasUnits to ensure the Buy flow triggers reliably in those environments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Dashboard Involves changes to the Dashboard.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants